home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Mail / EnhanceMail.1.3 / Source / regexp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-05  |  1.4 KB  |  48 lines

  1. #ifndef REGEXP_H__
  2. #define REGEXP_H__
  3.  
  4. /*
  5.  * Definitions etc. for regexp(3) routines.
  6.  *
  7.  * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
  8.  * not the System V one.
  9.  *
  10.  * MODIFICATION NOTE -- this is a modified version
  11.  * 
  12.  * I hacked this to add the "regtest()" function, which behaves in the
  13.  * same way as re_comp() in terms of returning the error. regerror()
  14.  * was also hacked so as to record the error in a global variable, and
  15.  * not call exit().
  16.  *
  17.  * I've also hacked it so that "#" will match [0-9], ie. a digit.
  18.  * this makes my usage of this to be simpler. I've also added prototypes
  19.  * in most places. I also added the #ifdef guard at the top of this file.
  20.  *
  21.  * - darcy <samurai@hasc.ca> Jan 19, 1995
  22.  *
  23.  */
  24. #define NSUBEXP  10
  25. typedef struct regexp {
  26.     const char *startp[NSUBEXP];
  27.     const char *endp[NSUBEXP];
  28.     char regstart;        /* Internal use only. */
  29.     char reganch;        /* Internal use only. */
  30.     char *regmust;        /* Internal use only. */
  31.     int regmlen;        /* Internal use only. */
  32.     char program[1];    /* Unwarranted chumminess with compiler. */
  33. } regexp;
  34.  
  35. /* the last error code - db */
  36. extern char * regerrval;
  37.  
  38. /* call this to test a pattern. Reutns 0 if OK, an error string if not - db */
  39. extern char * regtest(const char *exp);
  40.  
  41. extern int regexec(regexp *prog, const char *string);
  42. extern regexp * regcomp(const char *exp);
  43. extern void regdump(regexp *r);
  44. extern void regsub();
  45. extern void regerror();
  46.  
  47. #endif
  48.